home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9617 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Leap Years
  5. Date: Tue, 12 Mar 96 01:26:20 GMT
  6. Organization: none
  7. Message-ID: <826593980snz@genesis.demon.co.uk>
  8. References: <8BA8405.02C70020E1.uuout@sourcebbs.com> <4h6ara$mu@netnews1.apci.com> <825684095snz@genesis.demon.co.uk> <4i0sd4$7lr@peachy.apana.org.au>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4i0sd4$7lr@peachy.apana.org.au>
  15.            grahamb@peachy.apana.org.au "Graham Broadbridge" writes:
  16.  
  17. >Lawrence Kirby (fred@genesis.demon.co.uk) wrote:
  18. >: In article <4h6ara$mu@netnews1.apci.com> wardmw@apci.com "Martin Ward"
  19. > writes:
  20. >
  21. >: >david.mohorn@sourcebbs.com (DAVID MOHORN) typed:
  22. >: >
  23. >: >>How do you feature out leap years?  If its evenly divisible by 400 and
  24. >: >>4?
  25.  
  26. Please take a little more care in trimming down your attributions.
  27.  
  28. >I can't believe that anyone here can get confused about this.
  29. >
  30. >isleap(int year)
  31. >{
  32. >if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
  33. >        printf("%d is a leap year", year);
  34. >else
  35. >        printf("%d is not a leap year", year);
  36. >}
  37.  
  38. Read the FAQ. The version it contains is slightly more efficient than this
  39. one.
  40.  
  41. -- 
  42. -----------------------------------------
  43. Lawrence Kirby | fred@genesis.demon.co.uk
  44. Wilts, England | 70734.126@compuserve.com
  45. -----------------------------------------
  46.